Assignments in the statistics courses in psychology at UoE will require you to submit according to one of the following:
For some assignments (DAPR1 Lab tests, DAPR1 Report, USMR Report) there is a template .Rmd file provided for you, in which you can write your answers.
If there is no template .Rmd file provided, this means that you are to write your assignment from a blank slate.
Instructions on Learn for the specific assignment will provide you with guidance on how to structure your report, but some general tips are to try to include:
The code you write should successfully conduct the analysis described in A), which returns B). You should also include the code to produce C).
Stop and think:
The compiled document will ideally contain no visible R code. This means that a large part of the challenge comes in clearly describing all aspects of the analysis procedure. A reader of your compiled document should be able to more or less replicate your analyses without referring to your R code.
Click on a screenshot to zoom in, then click on it to minimise it
RMarkdown compiles using its own environment
When you “knit” an RMarkdown document, the document compiles starting from a blank slate. This means that if you haven’t written in your RMarkdown document where to read the data from, it will not be to access the data even if you can see the data in your environment (top-right window of RStudio).
It also means that you need to pay special attention to the order in which code is written in your document.
Consider the code below. I could run this code manually (in my environment) by running the second line (creating the kermit object) then the first line (calculating the mean). # When you knit an RMarkdown document with this code in it, it will run sequentially, which means that it will try to calculate the mean of kermit before it knows what kermit is!.
mean(kermit)
kermit <- c(5,7,2,5,205,3,5,3)
Common errors and things to look for
plot_model() function from the sjPlot package, have you loaded library(sjPlot) in the document? and have you loaded it in a line earlier than your first use of plot_model()?You can control whether the code in a code-chunk gets shown/evaluated etc using chunk-options such as echo, eval, include, warning, message etc. See here for more info.
Click on a screenshot to zoom in, then click on it to minimise it
When you click “knit” on your .Rmd, if the document has successfully compiled (no errors), then the compiled document (e.g. .html) will be created in the same folder as where your .Rmd is saved.
Click on a screenshot to zoom in, then click on it to minimise it
If you are working on the Rstudio PPLS Server, you need to first export the file(s) to your computer.
1. Tick the box(es) next to relevant files
2. Click More, then Export
3. Save to your computer
(You won’t be able to open the .rmd on your computer (because you don’t have rstudio installed), but that is okay, you can still submit this file to turnitin.
If you are using Rstudio installed on your own computer, you can find both your files wherever you saved your .Rmd file!
Turnitin will show you a preview of files when you submit them, and the viewer will probably mess-up what the .html looks like. Do not worry if some figures and tables are not shown in Turnitin, but are definitely visible in your original file. We will mark the original files.